<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	<xsl:template match="/">
		<infopost-request>
			<xsl:for-each select="BusinessTransactionRequest">
				<request-head>
					<xsl:for-each select="BusinessTransaction">
						<trans-id>
							<xsl:value-of select="transationId" />
						</trans-id>
						<trans-type>207</trans-type>
						<insu-id />
						<trans-date>
							<xsl:value-of select="concat(substring(string(/BusinessTransactionRequest/BusinessTransaction/transationDate),1,4),substring(string(/BusinessTransactionRequest/BusinessTransaction/transationDate),6,2),substring(string(/BusinessTransactionRequest/BusinessTransaction/transationDate),9,2))" />
						</trans-date>
						<trans-time>
							<xsl:value-of select="concat(substring(string(/BusinessTransactionRequest/BusinessTransaction/transationDate),12,2),substring(string(/BusinessTransactionRequest/BusinessTransaction/transationDate),15,2),substring(string(/BusinessTransactionRequest/BusinessTransaction/transationDate),18,2))" />
						</trans-time>
						<area>002</area>
						<bank>002</bank>
						<branch />
						<post>
							<xsl:value-of select="partnerCode" />
						</post>
						<agency-hand />
						<authorized>life</authorized>
						<column1>
							<xsl:value-of select="isApply" />
						</column1>
						<column5>
							<xsl:value-of select="orderNumber" />
						</column5>
					</xsl:for-each>
				</request-head>
				<request-intraday-cancel>
					<xsl:for-each select="InsurancePolicy">
						<related-trans-id>
							<xsl:value-of select="payMode" />
						</related-trans-id>
						<apply-code>
							<xsl:value-of select="bankCode" />
						</apply-code>
						<column2>
							<xsl:value-of select="accountNumber" />
						</column2>
						<column3>
							<xsl:value-of select="accountHolderName" />
						</column3>
						<policy-code>
							<xsl:value-of select="externalReference" />
						</policy-code>
					</xsl:for-each>
					<xsl:for-each select="/BusinessTransactionRequest/BusinessTransaction/Properties/Property">
						<xsl:choose>
							<xsl:when test="@kind='withdrawMoney' ">
								<premium>
									<xsl:value-of select="@value" />
								</premium>
							</xsl:when>
							<xsl:when test="@kind='isCancel' ">
								<column1>
									<xsl:value-of select="@value" />
								</column1>
							</xsl:when>
						</xsl:choose>
					</xsl:for-each>
				</request-intraday-cancel>
			</xsl:for-each>
		</infopost-request>
	</xsl:template>
</xsl:stylesheet>
